import React, { Component } from 'react'
import {
    StyleSheet,
    View,
    Text,
    TouchableWithoutFeedback,
    Image
} from 'react-native';


import NavigatorBar from './common/NavigationBar';


class Test extends Component {

    render() {
        return (
            <View>
                <NavigatorBar
                    title={'确认订单'}
                    style={styles.navigatorBar}
                    leftButton={this.renderLeftButton(require('./assets/imgs/back.png'))}
                />
                <Text>
                    Hello World
            </Text>
            </View>
        )
    }

    // 渲染按钮
    renderLeftButton(image) {
        return <TouchableWithoutFeedback
            style={{ padding: 8 }}
            onPress={() => {
                //this.props.navigation.goBack();
                global.log(this.props.navigation, "=======444444444444444444========")

                if (this.props.navigation.state.routeName == "FirstRouter") {
                    this.props.navigation.navigate("HomePage");
                } else {
                    this.props.navigation.goBack();
                }


            }}>
            <Image
                style={{ width: 34, height: 34 }}
                source={image} />
        </TouchableWithoutFeedback>;
    }

}


const styles = StyleSheet.create({
    navigatorBar: {
        backgroundColor: '#BFBFBF'
    }

});

export default Test;